﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace AR_Designer.ARControl
{
    public class BindedARControl
    {
        private string markerID;
        private DateTime lastSeen;
        private FrameworkElement control;


        /// <summary>
        /// Define new ARControl that will be associated with marker ID
        /// </summary>
        /// <param name="UIControl">the controll you want to associate</param>
        /// <param name="AssociateWithMarkerID">marker ID that will show the defined controll</param>
        public BindedARControl(FrameworkElement UIControl, string AssociateWithMarkerID)
        {
            control = UIControl;
            control.Visibility = Visibility.Collapsed;
            markerID = AssociateWithMarkerID;
            lastSeen = DateTime.MinValue;
        }

        /// <summary>
        /// Returns associated controll
        /// </summary>
        public FrameworkElement Control
        {
            get
            {
                return control;
            }
        }

        /// <summary>
        /// Returns a TimeSpan from the last seen time
        /// </summary>
        public TimeSpan LastSeen
        {
            get { 
                return DateTime.Now.Subtract(lastSeen);
            }
        }

        /// <summary>
        /// returns markerID
        /// </summary>
        public string MarkerID
        {
            get
            {
                return markerID;
            }
        }

        /// <summary>
        /// resets the last seen TimeSpan
        /// </summary>
        public void UpdateLastSeen()
        {
            lastSeen = DateTime.Now;
        }



    }
}
